home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / COLOR.SWG / 0015_Some More Palette Control.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  75 lines

  1. {
  2. >The utility I wrote, just Writes the contents of the $A000 from one to
  3. >63999 (ya know 320x200), to a File.  then I bring it to an Array, and
  4. >then I try to reWrite it to the video.  HOWEVER, I noticed that the
  5. >palette inFormation is incorrect.  Is there any way to fix this, since
  6. >it comes out in a messed up color.
  7.  
  8. How about writing also the palette info to the File ? You're probably
  9. BlockWriting, so this should not be a big problem. You just have to
  10. fetch the palette info through inT $10, Function $1017 :
  11. }
  12.  
  13. Type
  14.   TCouleurVGA =
  15.     Record
  16.       Rouge,
  17.       Vert,
  18.       Bleu   : Byte ;
  19.     end ;
  20.  
  21.   TPaletteVGA = Array[0..255] of TCouleurVGA ;
  22.  
  23. Procedure LitPalette(Var p : TPaletteVGA) ; Assembler ;
  24. Asm
  25.   { Lecture table couleurs }
  26.   Mov       AX, $1017
  27.   Mov       BX, 0
  28.   Mov       CX, 256
  29.   LES       DX, p
  30.   Int       $10
  31. end ;
  32.  
  33. {
  34. The reverse :
  35. }
  36.  
  37. Procedure AffectePalette(Var Palette : TPaletteVGA) ; Assembler ;
  38. Asm
  39.   Mov     AX, $1012
  40.   Xor     BX, BX
  41.   Mov     CX, 256
  42.   LES     DX, Palette
  43.   Int     $10
  44. end ;
  45.  
  46. {
  47. >Also, I have successfully written color cycling, by changing each color
  48. >index in a loop.  Only problem is that you can see it 'redrawing'.  Is
  49. >there anyway ot change them all simultaneously, instead of a loop?  I am
  50. >working in Pascal, using bits and chunks of Inline Asm.
  51.  
  52. I'm _not_ sure the following is the answer you expect :
  53. }
  54.  
  55. Procedure AffectePaletteDeA(Var Palette ; De, A : Integer) ; Assembler ;
  56. Asm
  57.   Mov     AX, $1012
  58.   Mov     BX, De
  59.   Mov     CX, A
  60.   Sub     CX, BX
  61.   Inc     CX
  62.   LES     DX, Palette
  63.   Int     $10
  64. end ;
  65.  
  66. Var
  67.   Pal  : TPaletteVGA ;
  68.  
  69. begin
  70.   { Here, fill the colors you need }
  71.   { Say, you modified colors 37 to 124 into Pal Array }
  72.   AffectePaletteDeA(Pal[37], 37, 124) ;
  73. end.
  74.  
  75.